package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;


@Entity
@Table(name = "bjdacp_zone")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Zone extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "行政区域";
	public static final String ALIAS_ZONE_ID = "zoneId";
	public static final String ALIAS_ZONE_NAME = "区域名称";
	public static final String ALIAS_ZONE_CODE = "区域编码";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * zoneId       db_column: zone_id
     */

	private java.lang.Integer zoneId;
    /**
     * 区域名称       db_column: zone_name
     */
	@Length(max=100)
	private java.lang.String zoneName;
    /**
     * 区域编码       db_column: zone_code
     */
	@Length(max=100)
	private java.lang.String zoneCode;
	//columns END


	public Zone(){
	}

	public Zone(
		java.lang.Integer zoneId
	){
		this.zoneId = zoneId;
	}



	public void setZoneId(java.lang.Integer value) {
		this.zoneId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "zone_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getZoneId() {
		return this.zoneId;
	}

	@Column(name = "zone_name", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getZoneName() {
		return this.zoneName;
	}

	public void setZoneName(java.lang.String value) {
		this.zoneName = value;
	}

	@Column(name = "zone_code", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getZoneCode() {
		return this.zoneCode;
	}

	public void setZoneCode(java.lang.String value) {
		this.zoneCode = value;
	}


	private Set drugSellUnits = new HashSet(0);
	public void setDrugSellUnits(Set<DrugSellUnit> drugSellUnit){
		this.drugSellUnits = drugSellUnit;
	}

	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "zone")
	public Set<DrugSellUnit> getDrugSellUnits() {
		return drugSellUnits;
	}

	private Set drugSellUnitPrepares = new HashSet(0);
	public void setDrugSellUnitPrepares(Set<DrugSellUnitPrepare> drugSellUnitPrepare){
		this.drugSellUnitPrepares = drugSellUnitPrepare;
	}

	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "zone")
	public Set<DrugSellUnitPrepare> getDrugSellUnitPrepares() {
		return drugSellUnitPrepares;
	}

	private Set wangDians = new HashSet(0);
	public void setWangDians(Set<WangDian> wangDian){
		this.wangDians = wangDian;
	}

	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "zone")
	public Set<WangDian> getWangDians() {
		return wangDians;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("ZoneId",getZoneId())
			.append("ZoneName",getZoneName())
			.append("ZoneCode",getZoneCode())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getZoneId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof Zone == false) return false;
		if(this == obj) return true;
		Zone other = (Zone)obj;
		return new EqualsBuilder()
			.append(getZoneId(),other.getZoneId())
			.isEquals();
	}
}

